<?php
if (!defined('IN_XLP')) {
    exit('Access Denied');
}
$Document = array(
    'pageid' => 'news-index', //页面标示
    'pagename' => '新闻列表', //当前页面名称
    'mycss' => array('content/textlist'), //加载的css样式表
    'myjs' => array(), //加载的js脚本
	 //'footerjs'=>array('content/highcharts', 'content/exporting',),
    'footerjs'=>array('content/fuelux/fuelux', 'content/combodate/moment.min', 'content/jquery.waterfall','content/jquery.smoothConfirm'),
    'head' => true, //加载头部文件
);

include getTpl('header', 'public');
?>
<!--顶部导航 开始-->
<?php include getTpl('top', 'public');?>
<!--顶部导航 结束-->
<!--左侧菜单 开始-->
<?php include getTpl('nav', 'public');?>
<!--左侧菜单 结束-->
<!--主体 开始-->
<!-- content -->
  <section id="content">
    <div class="main padder"> 
    <div class="clearfix"><h4><i class="fa fa-edit"></i>新闻列表--[ <?php echo isset($newsClassify[$tid])?$newsClassify[$tid]:$newsClassify[0];?> ]</h4></div> 
    <div class="row"> 
     <div class="col-sm-12"> 
      <div class="panel"> 
       <div class="panel-body"> 
        	<!--内容 B-->
            <!--添加图文 B-->
            <span class="create_access">
                <i class="icon36_common add_gray"></i>
                <a href="<?php echo U('news/add',array('tid'=>$tid));?>">
                    <i class="icon_appmsg_create"></i>
                    <strong>单图文消息</strong>
                </a>
                <a href="<?php echo U('news/addmore',array('tid'=>$tid));?>">
                    <i class="icon_appmsg_create multi"></i>
                    <strong>多图文消息</strong>
                </a>
            </span>
            <!--添加图文 E-->

            <!--图文列表 B-->
            <div class="appmsg_list" id="pubuliu" style="position:relative;">
            <?php
            if ($rs){
				foreach($rs as $val){
			?>
            <?php
            if ($val['type']=='one'){
			?>
                <!--单图文 B-->
                <div class="appmsg" id="list_detail_<?php echo $val['id'];?>">
                    <div class="appmsg_content">
                        <h4 class="appmsg_title"><a target="_blank" href="<?php echo U('news/detail',array('id'=>$val['id']));?>"><?php echo $val['header']['title'];?></a></h4>
                        <div class="appmsg_info">
                            <em class="appmsg_date"><?php echo outTime($val['header']['infotime'],2);?></em>
                        </div>
                        <div class="appmsg_thumb_wrp"><img class="appmsg_thumb" alt="" src="<?php echo getImgUrl($val['header']['picurl']);?>"></div>
                        <p class="appmsg_desc"><?php echo $val['header']['description'];?></p>
                    </div>
                    <div class="appmsg_opr">
                        <ul>
                            <li class="appmsg_opr_item grid_item size1of2">
                            <a data-tooltip="编辑" href="<?php echo U('news/edit',array('id'=>$val['id']));?>" class="js_tooltip">&nbsp;<i class="icon18_common edit_gray">编辑</i></a>
                            </li>
                            <li class="appmsg_opr_item grid_item size1of2 no_extra">
                                <a data-tooltip="删除" href="javascript:void(0);" data-id="<?php echo $val['id'];?>" class="js_del no_extra js_tooltip">&nbsp;<i class="icon18_common del_gray">删除</i></a>
                            </li>
                        </ul>
                    </div>
                </div>
                <!--单图文 B-->
               <?php
			}else{
			   ?> 
                <!--多图文 B-->
                <div class="appmsg multi" id="list_detail_<?php echo $val['id'];?>">
                    <div class="appmsg_content">
                            <div class="appmsg_info">
                                <em class="appmsg_date"><?php echo outTime($val['header']['infotime'],2);?></em>
                            </div>
                            <div class="cover_appmsg_item">
                                <h4 class="appmsg_title"><a target="_blank" href="<?php echo U('news/detail',array('id'=>$val['header']['id']));?>"><?php echo $val['header']['title']?></a></h4>
                                <div class="appmsg_thumb_wrp"><img class="appmsg_thumb" alt="" src="<?php echo getImgUrl($val['header']['picurl']);?>"></div>
                            </div>
                            <?php
                            foreach($val['items'] as $v){
							?>
                            <div class="appmsg_item">
                                <img class="appmsg_thumb" alt="" src="<?php echo getImgUrl($v['picurl']);?>">
                                <h4 class="appmsg_title"><a target="_blank" href="<?php echo U('news/detail',array('id'=>$v['id']));?>"><?php echo $v['title'];?></a></h4>
                            </div>
							<?php
							}
							?>
                    </div>
                    <div class="appmsg_opr">
                        <ul>
                            <li class="appmsg_opr_item grid_item size1of2">
                            <a data-tooltip="编辑" href="<?php echo U('news/edit',array('id'=>$val['id']));?>" class="js_tooltip">&nbsp;<i class="icon18_common edit_gray">编辑</i></a>
                            </li>
                            <li class="appmsg_opr_item grid_item size1of2 no_extra">
                                <a data-tooltip="删除" href="javascript:void(0);" data-id="<?php echo $val['id'];?>" class="js_del no_extra js_tooltip">&nbsp;<i class="icon18_common del_gray">删除</i></a>
                            </li>
                        </ul>
                    </div>
                </div>
                <!--多图文 E-->
                <?php
			}
				?>
                <?php
				}
			}
				?>
        <!--内容 E-->
       </div>
       <footer class="panel-footer"> 
            <div class="row"> 
                <div class="col-sm-12 text-right text-center-sm"><?php echo page($total,$p,'',20,'p');?></div> 
            </div> 
        </footer> 
      </div>
     </div> 
    </div> 
   </div> 
</div>
  </section> 
  <!--/ content --> 
<!--主体 结束-->
<script>
$(function(){
	$('#pubuliu').waterfall({item:".appmsg"});
	$(window).resize(function(){
		$('#pubuliu').waterfall({item:".appmsg"});
	});
	$('.js_del').click(function(){
		var id=$(this).attr('data-id');
	  $(this).smoothConfirm("确认删除该信息吗？", {
		  ok: function() {
			  Msg.loading();
			  $.post('<?php echo U('news/delete');?>',{"id":id},function(result){
				  Msg.hide();
				  $("#list_detail_"+id).fadeOut();
			  },'json');
		  },
		  //点击取消返回callback
		  cancel: function() {
			  return false;
		  }
	  });
	  $("body").click();
	  return false;
	})
})
</script>

<?php
include getTpl('footer', 'public');
?>